package com.bzm.common.entity;

import com.bzm.common.global.GlobalConfig;
import com.github.pagehelper.Page;

import lombok.Data;

@Data
public class JsonPageResult<T> {
	/**
	 * 返回数据
	 */
    private T data;
    
    /**
     * 错误码
     */
    private Integer code;
    
    /**
     * 描述信息
     */
    private String msg;
    
    /**
     * 总数量
     */
    private Long total;
    
    /**
     * 总页数
     */
    private int pages;

    private int currentPage;
    
    private String fileService;

    private int pageSize;
    
    public JsonPageResult(){
    	
    }
    
    public JsonPageResult(T data,HttpCode httpCode,Page<Object> page) {
        this.data = data;
        this.code = httpCode.getCode();
        this.msg = httpCode.getMsg();
        this.total=page.getTotal();
        this.pages=page.getPages();
        this.currentPage = page.getPageNum();
        this.pageSize = page.getPageSize();
        this.fileService = GlobalConfig.FILE_SERVICE_LOCATION;
    }
}
